import { ExcelDescriptor } from "./excelUtil";

let ynEnums = ['Y', 'N'];
let tfEnums = ['T', 'F'];

let menuExcelDescriptor: ExcelDescriptor = {
    sheets: [
        {
            name: 'OrderType',
            fromColumn: 2,
            fromRow: 2,
            toRow: 2,   // 只取1行数据
            columns: [
                {
                    fieldName: 'ALL',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'DINE_IN',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'TOGO',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'PICKUP',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'DELIVERY',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'ONLINE_TOGO',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'ONLINE_PICKUP',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'ONLINE_DELIVERY',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'KIOSK_DINE_IN',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'KIOSK_TOGO',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'EMENU_DINE_IN',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'SELF_DINE_IN',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'CUSTOM_ORDER_TYPE1',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'CUSTOM_ORDER_TYPE2',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'CUSTOM_ORDER_TYPE3',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
                {
                    fieldName: 'CUSTOM_ORDER_TYPE4',
                    dataType: 'enum',
                    enumVals: ynEnums,
                    defaultVal: 'N'
                },
            ]
        },
        {
            name: 'Group',
            fromRow: 2,
            columns: [
                {
                    fieldName: 'name',
                    dataType: 'string',
                    required: true
                },
                {
                    fieldName: 'secondLangName',
                    dataType: 'string',
                },
                {
                    fieldName: 'description',
                    dataType: 'string',
                }
            ]
        },
        {
            name: 'Category',
            fromRow: 2,
            columns: [
                {
                    fieldName: 'groupName',
                    dataType: 'string',
                    required: true,
                    useTopValueOnMissing: true,
                },
                {
                    fieldName: 'name',
                    dataType: 'string',
                    required: true
                },
                {
                    fieldName: 'secondLangName',
                    dataType: 'string',
                },
                {
                    fieldName: 'kitchenName',
                    dataType: 'string',
                },
                {
                    fieldName: 'secondLangKitchenName',
                    dataType: 'string',
                },
                {
                    fieldName: 'posName',
                    dataType: 'string',
                },
                {
                    fieldName: 'secondLangPosName',
                    dataType: 'string',
                },
                {
                    fieldName: 'allowDiscount',
                    dataType: 'enum',
                    enumVals: tfEnums,
                    defaultVal: 'T'
                },
                {
                    fieldName: 'optionGroupNames',
                    dataType: 'array',
                    arraySeparator: '/'
                },
                {
                    fieldName: 'description',
                    dataType: 'string',
                }
            ]
        },
        {
            name: 'Item',
            fromRow: 2,
            columns: [
                {
                    fieldName: 'categoryName',
                    dataType: 'string',
                    useTopValueOnMissing: true,
                },
                {
                    fieldName: 'name',
                    dataType: 'string',
                    required: true
                },
                {
                    fieldName: 'secondLangName',
                    dataType: 'string',
                },
                {
                    fieldName: 'itemNumber',
                    dataType: 'string',
                },
                {
                    fieldName: 'kitchenName',
                    dataType: 'string',
                },
                {
                    fieldName: 'secondLangKitchenName',
                    dataType: 'string',
                },
                {
                    fieldName: 'posName',
                    dataType: 'string',
                },
                {
                    fieldName: 'secondLangPosName',
                    dataType: 'string',
                },
                {
                    fieldName: 'prices',
                    dataType: 'array',
                    arraySeparator: '/'
                },
                {
                    fieldName: 'openPrice',
                    dataType: 'enum',
                    enumVals: tfEnums,
                    defaultVal: 'F'
                },
                {
                    fieldName: 'unitPrice',
                    dataType: 'enum',
                    enumVals: tfEnums,
                    defaultVal: 'F'
                },
                {
                    fieldName: 'printers',
                    dataType: 'array',
                    arraySeparator: '/'
                },
                {
                    fieldName: 'itemType',
                    dataType: 'enum',
                    enumVals: ['REGULAR', 'FIXED_COMBO', 'FLEXIBLE_COMBO'],
                    defaultVal: 'REGULAR'
                },
                {
                    fieldName: 'hidden',
                    dataType: 'enum',
                    enumVals: tfEnums,
                    defaultVal: 'F'
                },
                {
                    fieldName: 'optionGroupNames',
                    dataType: 'array',
                    arraySeparator: '/'
                },
                {
                    fieldName: 'comboSectionNames',
                    dataType: 'array',
                    arraySeparator: '/'
                },
                {
                    fieldName: 'description',
                    dataType: 'string',
                },
            ]
        },
        {
            name: 'Options',
            fromRow: 2,
            columns: [
                {
                    fieldName: 'optionGroupName',
                    dataType: 'string',
                    useTopValueOnMissing: true
                },
                {
                    fieldName: 'maxSelected',
                    dataType: 'number',
                    defaultVal: 0
                },
                {
                    fieldName: 'name',
                    dataType: 'string',
                    required: true
                },
                {
                    fieldName: 'secondLangName',
                    dataType: 'string',
                },
                {
                    fieldName: 'price',
                    dataType: 'number',
                    required: true
                },
                {
                    fieldName: 'printers',
                    dataType: 'array',
                    arraySeparator: '/'
                },
            ]
        },
        {
            name: 'ComboSection',
            fromRow: 2,
            columns: [
                {
                    fieldName: 'name',
                    dataType: 'string',
                    required: true,
                    useTopValueOnMissing: true
                },
                {
                    fieldName: 'displayName',
                    dataType: 'string',
                },
                {
                    fieldName: 'secondLangName',
                    dataType: 'string',
                },
                {
                    fieldName: 'numberRule',
                    dataType: 'enum',
                    enumVals: ['equal', 'min', 'max', 'range'],
                    defaultVal: 'max'
                },
                {
                    fieldName: 'min',
                    dataType: 'number',
                    defaultVal: 0
                },
                {
                    fieldName: 'max',
                    dataType: 'number',
                    defaultVal: 0
                },
                {
                    fieldName: 'pricingRule',
                    dataType: 'enum',
                    enumVals: ['Fixed', 'Adjustable', 'Fixed_Until_Max'],
                    defaultVal:'Adjustable'
                },
                {
                    fieldName: 'itemName',
                    dataType: 'string',
                    required: true
                },
                {
                    fieldName: 'secondLangItem',
                    dataType: 'string',
                },
                {
                    fieldName: 'itemPrice',
                    dataType: 'number',
                    required: true
                },
                {
                    fieldName: 'printers',
                    dataType: 'array',
                    arraySeparator: '/'
                },
                {
                    fieldName: 'preSelected',
                    dataType: 'enum',
                    enumVals: tfEnums,
                    defaultVal: 'F'
                },
            ]
        },
        {
            name: 'GlobalOption',
            fromRow: 2,
            columns: [
                {
                    fieldName: 'categoryName',
                    dataType: 'string',
                    required: true,
                    useTopValueOnMissing: true
                },
                {
                    fieldName: 'secondLangCategoryName',
                    dataType: 'string',
                },
                {
                    fieldName: 'itemName',
                    dataType: 'string',
                    required: true,
                },
                {
                    fieldName: 'secondLangItemName',
                    dataType: 'string',
                },
                {
                    fieldName: 'price',
                    dataType: 'number',
                    defaultVal: 0
                },
                {
                    fieldName: 'printers',
                    dataType: 'array',
                    arraySeparator: '/'
                },
            ]
        }
    ]
}

export default menuExcelDescriptor;